package com.aaa.inside.mapper;

import com.aaa.entity.inside.Puton;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author aaa
 * @since 2020-11-25
 */
public interface PutonMapper extends BaseMapper<Puton> {
    @Select("select code,name from b_locator where warehouseid=#{warehouseid} and state='0' and type!='2'")
    List<Map> selectLocatorByWareId(Long warehouseid);
    @Select("select bs.locatorcode,bs.locatorname,bs.uqty from b_commodity bc join b_stock bs on bc.id=bs.commodityid\n" +
            "join b_locator bl on bs.locatorid=bl.id\n" +
            "where bs.warehouseid=#{warehouseid} and bl.type=2 and commoditybar=#{commoditybar} and bs.uqty>0")
    List<Map> selectOriLocByCombar(String commoditybar,Long warehouseid);
    @Select("select name,id from b_commodity where bar=#{commoditybar}")
    Map selectCommoditynameByBar(String commoditybar);
    @Select("select id,name from b_locator where code=#{oldlocatorcode}")
    Map selectOriLoIdNameByOldLoCode(String oldlocatorcode);
    @Select("select distinct bs.commodityname,bs.commoditybar from b_stock bs\n" +
            "join b_locator bl on bs.locatorid=bl.id\n" +
            "where bs.warehouseid=#{warehouseid} and bl.type=2 and bs.uqty>0")
    List<Map> selectComByWareId(Long warehouseid);
}
